package com.yuqing.sentimentapp.workspace;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.yuqing.sentimentapp.R;
import com.yuqing.sentimentapp.base.BaseFragment;
import com.yuqing.sentimentapp.login.bean.LoginResultBean;
import com.yuqing.sentimentapp.statistics.StatisticsActivity;
import com.yuqing.sentimentapp.utils.SharePrefrenceHelper;
import com.yuqing.sentimentapp.workspace.search.YqSearchActivity;
import com.yuqing.sentimentapp.workspace.search.YqSearchResultActivity;
import com.yuqing.sentimentapp.yqlist.activity.YqListActivity;

import butterknife.BindView;
import butterknife.OnClick;

public class WorkspaceFragment extends BaseFragment {

    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.ll_yq_list)
    LinearLayout llYqList;
    @BindView(R.id.ll_yq_search)
    LinearLayout llYqSearch;
    @BindView(R.id.ll_yq_statistics)
    LinearLayout llYqStatistics;
    @BindView(R.id.ll_yq_reprot)
    LinearLayout llYqReprot;
    String bjDeptCode = "1053105991406600192";
    private String deptLevel;
    private String deptCode;

    @Override
    protected int getLayoutResource() {
        return R.layout.fragment_workspace;
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        LoginResultBean.DataBean.UserBean user = SharePrefrenceHelper.getUser();
        if (user != null && user.getDeptVo() != null) {
            deptLevel = user.getDeptVo().getDeptLevel();
            deptCode = user.getDeptCode();
        }
        if (TextUtils.equals("0", deptLevel) || TextUtils.equals(bjDeptCode, deptCode)) {
            llYqReprot.setVisibility(View.GONE);
        } else {
            llYqReprot.setVisibility(View.VISIBLE);
        }
    }

    @Override
    protected void initPresenter() {

    }
    @OnClick({R.id.ll_yq_list, R.id.ll_yq_search, R.id.ll_yq_statistics, R.id.ll_yq_reprot})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.ll_yq_list:
                YqListActivity.goActivity(getActivity());
                break;
            case R.id.ll_yq_search:
                YqSearchActivity.goActivity(getActivity());
                break;
            case R.id.ll_yq_statistics:
                StatisticsActivity.goActivity(getActivity());
                break;
            case R.id.ll_yq_reprot:
                MessageReportActivity.goActivity(getActivity());
                break;
        }
    }
}
